package androidx.transition;

import android.animation.Animator;
import android.animation.TimeInterpolator;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.d;
import androidx.core.view.ViewCompat;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import o.fx;
import o.np;
import o.ns;
import o.nt;
import o.nw;
import o.nx;
import org.xmlpull.v1.XmlPullParser;

public class Slide extends Visibility {
    private static final c ˊॱ = new e() {
        public float ˎ(ViewGroup viewGroup, View view) {
            return view.getTranslationX() + ((float) viewGroup.getWidth());
        }
    };
    private static final TimeInterpolator ˋ = new DecelerateInterpolator();
    private static final c ˋॱ = new e() {
        public float ˎ(ViewGroup viewGroup, View view) {
            return view.getTranslationX() - ((float) viewGroup.getWidth());
        }
    };
    private static final c ˏॱ = new e() {
        public float ˎ(ViewGroup viewGroup, View view) {
            Object obj = 1;
            if (ViewCompat.ʼ(viewGroup) != 1) {
                obj = null;
            }
            if (obj != null) {
                return view.getTranslationX() + ((float) viewGroup.getWidth());
            }
            return view.getTranslationX() - ((float) viewGroup.getWidth());
        }
    };
    private static final c ͺ = new a() {
        public float ˋ(ViewGroup viewGroup, View view) {
            return view.getTranslationY() - ((float) viewGroup.getHeight());
        }
    };
    private static final c ॱᐝ = new e() {
        public float ˎ(ViewGroup viewGroup, View view) {
            Object obj = 1;
            if (ViewCompat.ʼ(viewGroup) != 1) {
                obj = null;
            }
            if (obj != null) {
                return view.getTranslationX() - ((float) viewGroup.getWidth());
            }
            return view.getTranslationX() + ((float) viewGroup.getWidth());
        }
    };
    private static final TimeInterpolator ᐝ = new AccelerateInterpolator();
    private static final c ᐝॱ = new a() {
        public float ˋ(ViewGroup viewGroup, View view) {
            return view.getTranslationY() + ((float) viewGroup.getHeight());
        }
    };
    private c ʻ = ᐝॱ;
    private int ॱˊ = 80;

    interface c {
        float ˋ(ViewGroup viewGroup, View view);

        float ˎ(ViewGroup viewGroup, View view);
    }

    static abstract class e implements c {
        private e() {
        }

        public float ˋ(ViewGroup viewGroup, View view) {
            return view.getTranslationY();
        }
    }

    static abstract class a implements c {
        private a() {
        }

        public float ˎ(ViewGroup viewGroup, View view) {
            return view.getTranslationX();
        }
    }

    @RestrictTo({d.LIBRARY_GROUP})
    @Retention(RetentionPolicy.SOURCE)
    public @interface GravityFlag {
    }

    public Slide() {
        ˏ(80);
    }

    public Slide(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, ns.ʻ);
        int ˊ = fx.ˊ(obtainStyledAttributes, (XmlPullParser) attributeSet, "slideEdge", 0, 80);
        obtainStyledAttributes.recycle();
        ˏ(ˊ);
    }

    private void ˎ(nx nxVar) {
        Object obj = new int[2];
        nxVar.ॱ.getLocationOnScreen(obj);
        nxVar.ˊ.put("android:slide:screenPosition", obj);
    }

    public void ˋ(@NonNull nx nxVar) {
        super.ˋ(nxVar);
        ˎ(nxVar);
    }

    public void ॱ(@NonNull nx nxVar) {
        super.ॱ(nxVar);
        ˎ(nxVar);
    }

    public void ˏ(int i) {
        switch (i) {
            case 3:
                this.ʻ = ˋॱ;
                break;
            case 5:
                this.ʻ = ˊॱ;
                break;
            case 48:
                this.ʻ = ͺ;
                break;
            case 80:
                this.ʻ = ᐝॱ;
                break;
            case 8388611:
                this.ʻ = ˏॱ;
                break;
            case 8388613:
                this.ʻ = ॱᐝ;
                break;
            default:
                throw new IllegalArgumentException("Invalid slide direction");
        }
        this.ॱˊ = i;
        nt npVar = new np();
        npVar.ॱ(i);
        ˊ(npVar);
    }

    public Animator ˏ(ViewGroup viewGroup, View view, nx nxVar, nx nxVar2) {
        if (nxVar2 == null) {
            return null;
        }
        int[] iArr = (int[]) nxVar2.ˊ.get("android:slide:screenPosition");
        float translationX = view.getTranslationX();
        float translationY = view.getTranslationY();
        return nw.ˋ(view, nxVar2, iArr[0], iArr[1], this.ʻ.ˎ(viewGroup, view), this.ʻ.ˋ(viewGroup, view), translationX, translationY, ˋ);
    }

    public Animator ˊ(ViewGroup viewGroup, View view, nx nxVar, nx nxVar2) {
        if (nxVar == null) {
            return null;
        }
        int[] iArr = (int[]) nxVar.ˊ.get("android:slide:screenPosition");
        return nw.ˋ(view, nxVar, iArr[0], iArr[1], view.getTranslationX(), view.getTranslationY(), this.ʻ.ˎ(viewGroup, view), this.ʻ.ˋ(viewGroup, view), ᐝ);
    }
}
